package com.smxy.mall.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "fat_order")
@Data
public class Order {
    @Id //主键Id
    @Column(name="id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @Column(name = "createTime",updatable = false,nullable=false)
    private Date createTime; //创建时间
    @LastModifiedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime; //更新时间
    @CreatedBy
    @Column(name = "createUser",updatable = false,nullable=false)
    private String createUser; //创建者
    @LastModifiedBy
    private String updateUser; //更新者

    private Integer shopId; //店铺id

    private String goodsId;  //商品数组 JSON字符串数组
    private String goodsList;  //商品信息 JSON字符串

    private Integer userId; //用户id
    private String userInfo; //下单用户信息
    private Integer addressId; //地址id
    private String addressInfo; //地址信息 字符串
    private String time; //配送时间

    private Integer couponId; //优惠券id
    private Integer orderType; //1配送 2自取
    private String orderTypeName; //配送方式名称
    private Integer payType; //支付方式 1微信
    private String payTypeName; //支付方式名称

    private Double orderMoney; //订单金额
    private Double payMoney; //支付金额
    private Double discountMoney; //优惠金额
    private Double sendMoney; //配送金额
    private Integer status;  //订单状态 0待付款 1已支付 2已发货 3待评价 4已完成 5已取消
    private String orderNo;   //订单编号
    private String tradeNo;   //交易编号
}
